src/Controller/MainController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Bundle\FrameworkBundle\Console\Application;
  8. use Symfony\Component\HttpKernel\KernelInterface;
  9. use Symfony\Component\Console\Input\ArrayInput;
  10. use Symfony\Component\Console\Output\BufferedOutput;
  11. use App\Service\CallAPI;
  12. use Symfony\Component\Debug\Debug;
  13. use Symfony\Component\HttpKernel\Profiler\Profiler;
  14. class MainController extends AbstractController
  15. {
  16.     /**
  17.      * @Route("/")
  18.      * @return Response
  19.      */
  20.     public function index(Profiler $profiler)
  21.     {
  22.         $profiler->enable();
  23.         $request = new Request(
  24.             $_GET,
  25.             $_POST,
  26.             [],
  27.             $_COOKIE,
  28.             $_FILES,
  29.             $_SERVER
  30.         );
  31.         $method $request->getMethod();
  32.         return $this->render('main/main.html.twig', ['method' => $method]);
  33.     }
  34.     /**
  35.      * @Route("/e48e13207341b6bffb7fb1622282247b")
  36.      * @return Response
  37.      */
  38.     public function admin(KernelInterface $kernel)
  39.     {
  40.         $url 'http://10.0.142.5'// IP de l'API
  41.         $call_api = new CallAPI();
  42.         $request = new Request(
  43.            $_GET,
  44.            $_POST,
  45.            [],
  46.            $_COOKIE,
  47.            $_FILES,
  48.            $_SERVER
  49.        );
  50.        $method $request->getMethod();
  51.         $get_data $call_api->callAPI('GET'$url.'?method='.$request->getMethod(), false);
  52.         $response $get_data;
  53.         return $this->render('main/admin.html.twig', ['response' => json_decode($response), 'method' => $method]);
  54.     }
  55.     /**
  56.      * @Route("/e48e13207341b6bffb7fb1622282247b/debug")
  57.      * @return Response
  58.      */
  59.     public function debug(Profiler $profiler)
  60.     {
  61.         $profiler->enable();
  62.         return $this->render('main/debug.html.twig');
  63.     }
  64. }